<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>灯泡</title>
</head>
<body>
	<script>
        function changeLight() {
            element = document.getElementById('image')
            if (element.src.match('eg_bulbon')){
                element.src ='eg_bulboff.gif'
            }else {
                element.src ='eg_bulbon.gif'
            }
        }
    </script>
    <img src="eg_bulbon.gif" id="image" onclick="changeLight()">
</body>
</html>